<template>
    <div class='newsinfo_content'>
        <h3 class='title'>{{newsInfo.title}}</h3>
        <p class='sbutitle'>
            <span>发表时间：{{newsInfo.add_time}}</span>
            <span>点击{{newsInfo.click}}次</span>
        </p>
        <hr>
        <div class='content' v-html='newsInfo.content'></div>

        <comment :id='id'></comment>
    </div>
</template>


<script>
import comment from '../subcomponent/comment.vue'

import { Toast } from 'mint-ui';
export default {
    data(){
        return {
          id: this.$route.params.id,
          newsInfo:{}
        }
    },
    created(){
        this.getNewsInfo()
    },
    methods: {
        getNewsInfo(){
            this.$http.get('api/getnew/' + this.id).then(res=>{
                // console.log(res)
                if(res.body.status==0){
                    this.newsInfo = res.body.message[0]
                }else{Toast('获取失败');}
            })
        }
    },
    components:{
        comment
    }
}
</script>


<style lang='scss' scoped>
    .newsinfo_content{
        padding: 10px;
        .title{
            color: red;
            text-align: center;
            font-size: 16px;
            margin: 15px 0;
        }
        .sbutitle{
            font-size: 15px;
            color: #225aff;
            display: flex;
            justify-content: space-between
        }
        .content{

        }
    }
</style>
